<template>
  <!-- 访客记录-详情 -->
  <div>
    <public-modal
      width="1000px"
      :footer="false"
      :title="title"
      modalStyle="detailModal"
      :publicVisible="publicVisible"
      cancelContext="拒绝"
      confirmContext="通过"
      @handleOk="handleOk"
      @cancel="cancel"
    >
      <div slot="content">
        <div class="common-title">
          <div class="icon"></div>
          <div class="content">单位信息</div>
        </div>
        <div class="content-wrapper">
          <div class="flex">
            <div class="info-wrap f1">
              <div class="label common-lable">单位名称</div>
              <div class="value common-value">{{ companyMessage.companyMessage || '暂无' }}</div>
            </div>
          </div>
          <div class="flex">
            <div class="info-wrap f1">
              <div class="label common-lable">标准地址</div>
              <div class="value common-value">{{ companyMessage.communityName || '暂无' }}</div>
            </div>
          </div>
          <div class="flex">
            <div class="info-wrap f1">
              <div class="label common-lable">单位负责人</div>
              <div class="value common-value">{{ companyMessage.dutyPersonName || '暂无' }}</div>
            </div>
            <div class="info-wrap f1">
              <div class="label common-lable">联系电话</div>
              <div class="value common-value">
                {{ companyMessage.mobile || '暂无' }}
              </div>
            </div>
          </div>
        </div>

        <div class="common-title">
          <div class="icon"></div>
          <div class="content">电瓶信息</div>
        </div>

        <div class="content-wrapper">
          <div class="flex">
            <div class="info-wrap f1">
              <div class="label common-lable">电瓶品牌</div>
              <div class="value common-value">
                {{ storagebatteryAcquisitionRecords.brand || '暂无' }}
              </div>
            </div>
            <div class="info-wrap f1">
              <div class="label common-lable">电压伏数</div>
              <div class="value common-value">
                {{ storagebatteryAcquisitionRecords.voltage ? `${storagebatteryAcquisitionRecords.voltage}V` : '暂无' }}
              </div>
            </div>
          </div>

          <div class="flex">
            <div class="info-wrap f1">
              <div class="label common-lable">数量</div>
              <div class="value common-value">{{ storagebatteryAcquisitionRecords.batterySum || '暂无' }}</div>
            </div>
            <div class="info-wrap f1">
              <div class="label common-lable">电瓶照片</div>
              <div
                class="value common-value deatil-color"
                v-if="storagebatteryAcquisitionRecords.saPathList"
                @click="handlePreview([storagebatteryAcquisitionRecords.saPathList])"
              >
                查看
              </div>
              <div class="value common-value" v-else>暂无</div>
            </div>
          </div>

          <div class="flex">
            <div class="info-wrap f1">
              <div class="label common-lable">回收时间</div>
              <div class="value common-value">
                {{ moment(storagebatteryAcquisitionRecords.recycleTime).format('YYYY/MM/DD HH:mm') || '暂无' }}
              </div>
            </div>
            <div class="info-wrap f1">
              <div class="label common-lable">上报时间</div>
              <div class="value common-value">
                {{ storagebatteryAcquisitionRecords.createTime || '暂无' }}
              </div>
            </div>
          </div>
        </div>

        <div class="common-title">
          <div class="icon"></div>
          <div class="content">售卖人信息</div>
        </div>

        <div class="content-wrapper">
          <div class="flex">
            <div class="info-wrap f1">
              <div class="label common-lable">售卖人</div>
              <div class="value common-value">{{ storagebatteryAcquisitionRecords.takeName || '暂无' }}</div>
            </div>
            <div class="info-wrap f1">
              <div class="label common-lable">手机号码</div>
              <div class="value common-value">
                {{ storagebatteryAcquisitionRecords.takePhone || '暂无' }}
              </div>
            </div>
          </div>

          <div class="flex">
            <div class="info-wrap f1">
              <div class="label common-lable">身份证号</div>
              <div class="value common-value">{{ storagebatteryAcquisitionRecords.takeIdcard || '暂无' }}</div>
            </div>
            <div class="info-wrap f1">
              <div class="label common-lable">人脸照片</div>
              <div
                class="value common-value deatil-color"
                v-if="storagebatteryAcquisitionRecords.personPathList"
                @click="handlePreview([storagebatteryAcquisitionRecords.personPathList])"
              >
                查看
              </div>
              <div class="value common-value" v-else>暂无</div>
            </div>
          </div>
        </div>
      </div>
      <div slot="footer"></div>
    </public-modal>
  </div>
</template>
<script>
import startEndTime from '@/components/startEndTime'
import publicModal from '@/components/publicModal'
import { JeecgListMixinNew } from '@/mixins/JeecgListMixinNew'
import { houseDetails } from '@/api/api'
import {
  rentingHouseDetails,
  storagebatteryAcquisitionRecordsDetails,
  webMachineRepairRecordDetails,
  webpopulationDetails,
} from '../../../../api/api'
import moment from 'moment'
import { getPrefixImg, previewImage } from '../../../../utils/util'

export default {
  name: 'actuallyDetail',
  components: { publicModal, startEndTime },
  mixins: [JeecgListMixinNew],
  props: {
    type: String,
    default: '', // 取车还是修车
  },
  data() {
    return {
      prefixImg: getPrefixImg(),
      url: {
        list: '/common/project_company_serve_record/page',
      },
      publicVisible: false,
      project_company_type: [],
      queryParams: { pageSize: 5 },
      ipagination: { pageSize: 5 },
      disableMixinCreated: true,
      housePopulationlist: [],
      listRecontract: [],
      listHistoricalContract: [],
      historyDetailRef: null,

      companyMessage: {},
      storagebatteryAcquisitionRecords: {},
    }
  },
  computed: {
    title() {
      return '电瓶回收详情'
    },
  },
  methods: {
    handlePreview(urls = []) {
      previewImage.call(this, urls)
    },
    moment,
    handlePopulationDetail(records) {
      this.$refs.populationDetailRef.show({
        ...records,
        id: records.fId,
      })
    },
    async show(records) {
      this.publicVisible = true
      this.getDetail(records)
    },
    getDetail(records) {
      const params = {
        id: records.id,
      }
      storagebatteryAcquisitionRecordsDetails(params).then((res) => {
        if (res.code == 200) {
          const { companyMessage, storagebatteryAcquisitionRecords } = res.result
          this.companyMessage = companyMessage
          this.storagebatteryAcquisitionRecords = storagebatteryAcquisitionRecords
        } else {
        }
      })
    },
    handleOk() {
      this.publicVisible = false
    },
    cancel(target) {
      this.publicVisible = false
    },
    handleHistoryDetail(records) {
      this.$refs.historyDetailRef.show(records)
    },
  },
}
</script>
<style scoped lang="less">
/deep/ .modalCotent {
  padding: 20px 40px;
  border-radius: 0 0 4px 4px;

  .img-style-wrapper {
    width: 140px;
    height: 124px;
    border-radius: 8px 8px 8px 8px;
    object-fit: cover;
    margin-right: 10px;
  }
}
</style>
